From 09a201be0899f265b53d652e90deb6866bf4b525 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Florian=20M=C3=BCllner?= Date: Thu, 20 Nov 2025 16:09:44 +0100 Subject: [PATCH] swipeTracker: Immediately flip delta in RTL locales The delta is currently flipped in a shared code path, after appending the unmodified value to the event history. As a result, the calculated final velocity for touchpad gestures is wrong in RTL locales. Fix this by modifying the delta immediately when handling the events, so that all other code operates on the correct values. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8840 Part-of: (cherry picked from commit a02835aacadbc14dc4350add3bae99c70e38f1b0) --- js/ui/swipeTracker.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js index 16138622b..950f2a6c1 100644 --- a/js/ui/swipeTracker.js +++ b/js/ui/swipeTracker.js @@ -561,10 +561,6 @@ export const SwipeTracker = GObject.registerClass({ if (this._state !== State.SCROLLING) return; - if (this.orientation === Clutter.Orientation.HORIZONTAL && - Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) - delta = -delta; - this._progress += delta / distance; this._progress = Math.clamp(this._progress, ...this._getBounds(this._initialProgress)); @@ -575,8 +571,8 @@ export const SwipeTracker = GObject.registerClass({ _updatePanGesture(panGesture) { const deltaVec = panGesture.get_delta_abs(); const delta = this.orientation === Clutter.Orientation.HORIZONTAL - ? -deltaVec.get_x() - : -deltaVec.get_y(); + ? this._getGestureDirFactor() * deltaVec.get_x() + : this._getGestureDirFactor() * deltaVec.get_y(); this._updateGesture(delta, this._distance); } @@ -587,6 +583,10 @@ export const SwipeTracker = GObject.registerClass({ return; } + if (this.orientation === Clutter.Orientation.HORIZONTAL && + Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) + delta = -delta; + this._history.append(time, delta); this._updateGesture(delta, distance); } -- 2.39.5